package com.qf.hospital.system.service.impl;

import com.qf.hospital.system.entity.Doctor;
import com.qf.hospital.system.mapper.DoctorMapper;
import com.qf.hospital.system.service.DoctorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Calendar;
import java.util.List;

@Service
public class DoctorServiceImpl implements DoctorService {

    @Autowired
    private DoctorMapper doctorMapper;

    private final String[] weeks = {"seven","one","two","three","four","five","six"};

    @Override
    public List<Doctor> findDoctorByCondition(Integer registeredId, Integer departments) {
        //1. 获取今日星期几
        Calendar calendar=Calendar.getInstance();
        String week = weeks[calendar.get(Calendar.DAY_OF_WEEK) - 1];
        //2. 调用service查询数据
        return doctorMapper.findDoctorByCondition(registeredId,departments,week);
    }
}
